package com.dong.datachangecontrol.demo.annotation;

import com.dong.datachangecontrol.demo.entity.Person;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.reflect.MethodSignature;
import org.aspectj.lang.reflect.SourceLocation;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.aspectj.lang.annotation.*;
@Component
@Aspect
public class PersonAspect {
    @Before(value ="@annotation(PersonSelect)")
    public void beforeSelect(JoinPoint joinPoint) {
        System.out.println("beforeSelect.....................");
        Object[] args = joinPoint.getArgs();
      //  System.out.println(select.value());
        MethodSignature signature = (MethodSignature)joinPoint.getSignature();
        PersonSelect annotation = signature.getMethod().getAnnotation(PersonSelect.class);
        String value = annotation.value();
        System.out.println(value+"*****************************************************");
    }
@Around(value = "@annotation(PersonUpdate)",argNames = "newPerson")
    public void aroundUpdatePerson(ProceedingJoinPoint  pjp, Person newPerson) {

    }
}
